﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using FBA.Client.Models;

namespace FBA.Client.Selector
{
    public partial class ReportTemplateSelector : DataTemplateSelector
    {
        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            var fe = container as FrameworkElement;
            ReportVariable rv = item as ReportVariable;
            DataTemplate dt = null;
            if (rv != null && fe != null)
            {
                dt = fe.FindResource(rv.InputType) as DataTemplate;
            }
            return dt;
        }
    }
}
